<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>高阶函数</title>
  </head>
  <body>
    <script>
      const t = [11, 22, 33, 55, 34, 28, 58, 42];
      // 将所有结果相加
      let b = t.reduce(function (prv, n) {
        return prv + n;
      });
      console.log(b); //283
      let tt = t
        .filter((n) => n > 22)
        .map((n) => n * 2)
        .reduce((prv, n) => prv + n);
      console.log(tt);
    </script>
  </body>
</html>
